import { request } from "@umijs/max";

/** 签到列表 */
export async function listCheckIns(data: PointsType.CheckInQuery) {
  return request<API.PageResult<PointsType.CheckInList>>(
    "/points/check-in-list",
    {
      method: "POST",
      data,
    }
  );
}

/** 创建签到规则 */
export async function createCheckIn(data: PointsType.CheckInCreate) {
  return request("/points/check-in-add", {
    method: "POST",
    data,
  });
}

/** 更新签到规则 */
export async function updateCheckIn(data: PointsType.CheckInUpdate) {
  return request("/points/check-in-update", {
    method: "PUT",
    data,
  });
}

/** 删除签到规则 */
export async function deleteCheckIn(id: number) {
  return request(`/points/check-in-delete/${id}`, {
    method: "DELETE",
  });
}

/** 签到列表 */
export async function listGiftGivings(data: PointsType.CheckInQuery) {
  return request<API.PageResult<PointsType.GiftGivingList>>(
    "/points/gift-giving-list",
    {
      method: "POST",
      data,
    }
  );
}

/** 创建签到规则 */
export async function createGiftGiving(data: PointsType.GiftGivingCreate) {
  return request("/points/gift-giving-add", {
    method: "POST",
    data,
  });
}

/** 更新签到规则 */
export async function updateGiftGiving(data: PointsType.GiftGivingUpdate) {
  return request("/points/gift-giving-update", {
    method: "PUT",
    data,
  });
}

/** 删除签到规则 */
export async function deleteGiftGiving(id: number) {
  return request(`/points/gift-giving-delete/${id}`, {
    method: "DELETE",
  });
}
